<!DOCTYPE HTML>
<html>

<head>
        <title></title>

        <script type="text/javascript">
          var mydiv;
          function new_div () 
          {
                mydiv = document.createElement("div");
                mydiv.id = "md";
                //mydiv.style = "color:green; position:absolute; top:225px; left:600px;";
                mydiv.style.color = "#00ff00";
                mydiv.style.position = "absolute";
                mydiv.style.top = "225px";
                mydiv.style.left = "600px";
                mydiv.innerHTML = "nihaonihaonihaonihaonihaonihao";
                document.body.appendChild(mydiv);
                alert(document.body.innerHTML);
          }

function countTags(n) {                         // n is a Node
    var numtags = 0;                            // Initialize the tag counter
    if (n.nodeType == 1 /*Node.ELEMENT_NODE*/)  // Check if n is an Element
        numtags++;                              // Increment the counter if so
    var children = n.childNodes;                // Now get all children of n
    for(var i=0; i < children.length; i++) {    // Loop through the children
        numtags += countTags(children[i]);      // Recurse on each one
    }
    return numtags;                             // Return the total
}        

        </script>

        <style type="text/css">
        </style>
</head>



<body onload="new_div();">

        <script type="text/javascript">
        
        //alert(countTags(document));
        </script>
</body>



</html>

